﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Checkpoint2XNA.Models.Chess
{
    public class Pawn : Model3D
    {
        const float RADIUS_MODIFIER = .3f;

        public SolidSphere Sphere;

        public Pawn(Vector3 p, float size, ChessSide c): base(p, c)
        {
            var radius = size * RADIUS_MODIFIER;
            Sphere = new SolidSphere(new Vector3(p.X, p.Y + radius/2, p.Z), radius, Color);
        }

        public override void MoveTo(Vector3 point)
        {
            Sphere.MoveTo(new Vector3(point.X, point.Y + Sphere.Radius / 2, point.Z));
            CenterBottom = point;
        }

        public override Microsoft.Xna.Framework.Color GetColorAt(Microsoft.Xna.Framework.Vector3 point)
        {
            return Color;
        }

        public override Microsoft.Xna.Framework.Vector3 GetNormal(Microsoft.Xna.Framework.Vector3 point)
        {
            return Sphere.GetNormal(point);
        }

        public override double RayCollide(Microsoft.Xna.Framework.Vector3 origin, Microsoft.Xna.Framework.Vector3 normalVector)
        {
            return Sphere.RayCollide(origin, normalVector);
        }
    }
}
